(*****************************************************************************
 * Delphi Plug-in Framework (DPF)
 * Copyright (C) 2006-2007 Tao Yuan
 *
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the
 * License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.                                                               }
 *
 * The Initial Developer of the Original Code is Tao Yuan. Portions created by
 * Tao Yuan are Copyright (C) Tao Yuan (taoy.cn att gmail dott com)
 * All rights reserved.
 *****************************************************************************)
 
unit DPFLog;

interface

uses
  RclLog, RclLogL4D, LogLab;

type
  LogFactory = class(TObject)
  public
    class function getLogger(AName: string): ILog; overload;
    class function getLogger(AObject: TObject): ILog; overload;
    class function getLogger(AClass: TClass): ILog; overload;
    class procedure loadConfiguration(AConfigFile: string);
  end;

implementation

uses TLevelUnit, TFileAppenderUnit;

class function LogFactory.getLogger(AName: string): ILog;
begin
  Result := GetLogVendor.GetLog(AName);
end;

class function LogFactory.getLogger(AObject: TObject): ILog;
begin
  Result := getLogger(AObject.ClassName);
end;

class function LogFactory.getLogger(AClass: TClass): ILog;
begin
  Result := getLogger(AClass.ClassName);
end;

class procedure LogFactory.loadConfiguration(AConfigFile: string);
begin
  GetLogVendor.Config(AConfigFile);
end;

initialization
  RclLog.PackageName := 'dpf';

end.
